<?php
/**
 * Caching mechanizm with apc
 * 
 * @version:	0.1
 * @package:	core
 * @author:		alex_ez
 * @created:	21 dec 2008
 *
 * @copyright:	(c) 2009 alex <qfox@ya.ru> yaroshevich aka alex_ez. All rights reserved.
 */

class cacher_apc implements cacher_interface
{
	public function __construct()
	{
		
	}

	public function retrieve($k) {
		return apc_fetch($k);
	}

	public function store($k,&$v,$ttl=12) {
		return apc_store($k,$v,$ttl);
	}

	public function drop($k)
	{
		return apc_delete($k);
	}

	public function cleanup()
	{
		return apc_clear_cache('user');
	}
	
	public function info() {
		$info = apc_cache_info('user');

		$renames = array('num_hits'=>'cache_hits','num_misses'=>'cache_misses');
		$result = array();
		foreach ($renames as $k => $l)
			$result[$l] = $info[$k];

		return $result;
	}
}


?>